import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import { getMenuList } from '@/components/Nav/Nav'
import { ref } from 'vue'
//菜单接口
let MenuData = {
  token:sessionStorage.getItem('token')
}
let MenuList = ref([])//菜单列表
// getMenuList('/garbageSys/menuList',MenuData)
// .then(res => {
//   if(res.code == 200){
//     MenuList.value = res.dataset
//     console.log(MenuList.value);
//   }
// })
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    //登录
    {
      path: '/',
      name: 'home',
      component: Login,
    },
    //地图
    {
      path:'/map',
      name:'map',
      component:() => import("@/views/map.vue")
    },
    //首页
    {
      path: '/HomePage',
      component: ()=>import("@/views/HomePage.vue"),
      redirect:"/HomePage/user",
      children:[
        //用户管理
        {
          path:"/HomePage/user",
          component:()=>import("@/views/UserMange/user.vue"),
        },
        //代理商团队
        {
          path:"/HomePage/agentTeam",
          component:()=>import("@/views/UserMange/agentTeam.vue")
        },
        //设备持有者
        {
          path:"/HomePage/deviceHolder",
          component:()=>import("@/views/UserMange/deviceHolder.vue")
        },
        //用户提现
        {
          path:"/HomePage/UserCash",
          component:()=>import("@/views/servicer/UserCash.vue")
        },
        //提现历史
        {
          path:"/HomePage/CashHistory",
          component:()=>import("@/views/servicer/CashHistory.vue")
        },
        //提现记录
        {
          path:"/HomePage/DeliverRecord",
          component:()=>import("@/views/servicer/DeliverRecord.vue")
        },
        //清运工单
        {
          path:"/HomePage/CleanList",
          component:()=>import("@/views/servicer/CleanList.vue")
        },
        //话术设置
        {
          path:"/HomePage/ScriptSet",
          component:()=>import("@/views/servicer/ScriptSet.vue")
        },
        //设备异常上报
        {
          path:"/HomePage/AbnormalReport",
          component:()=>import("@/views/AbnormalMange/AbnormalReport.vue")
        },
        //设备异常工单
        {
          path:"/HomePage/AbnormalList",
          component:()=>import("@/views/AbnormalMange/AbnormalList.vue")
        },
        //设备管理
        {
          path:"/HomePage/DeviceMange",
          component:()=>import("@/views/DeviceMange/DeviceMange.vue")
        },
        //设备管理2
        {
          path:"/HomePage/DeviceMangeTwo",
          component:()=>import("@/views/DeviceMange/DeviceMangeTwo.vue")
        },
        //设备指令
        {
          path:"/HomePage/DeviceInstruction",
          component:()=>import("@/views/DeviceMange/DeviceInstruction.vue")
        },
        //设备预警
        {
          path:"/HomePage/DeviceWarning",
          component:()=>import("@/views/DeviceMange/DeviceWarning.vue")
        },
        //清运记录
        {
          path:"/HomePage/CleanList2",
          component:()=>import("@/views/DeviceMange/CleanList.vue")
        },
        //安装记录
        {
          path:"/HomePage/InstallList",
          component:()=>import("@/views/DeviceMange/InstallList.vue")
        },
        //设备公告
        {
          path:"/HomePage/DeviceNotice",
          component:()=>import("@/views/Operation/DeviceNotice.vue")
        },
        //活动订单
        {
          path:"/HomePage/ActiveOrder",
          component:()=>import("@/views/Operation/ActiveOrder.vue")
        },
        //活动
        {
          path:"/HomePage/Active",
          component:()=>import("@/views/Operation/Active.vue")
        },
        //咨询
        {
          path:"/HomePage/seekAdviceFrom",
          component:()=>import("@/views/Operation/seekAdviceFrom.vue")
        },
        //咨询栏目
        {
          path:"/HomePage/seekAdviceFromColumn",
          component:()=>import("@/views/Operation/seekAdviceFromColumn.vue")
        },
        //设备统计
        {
          path:"/HomePage/DeviceStatistics",
          component:()=>import("@/views/Finance/DeviceStatistics.vue")
        },
        //设备持有人提现
        {
          path:"/HomePage/DeviceHolderCash",
          component:()=>import("@/views/Finance/DeviceHolderCash.vue")
        },
        //设备持有人订单
        {
          path:"/HomePage/DeviceHolderList",
          component:()=>import("@/views/Finance/DeviceHolderList.vue")
        },
        //代理商订单
        {
          path:"/HomePage/AgentList",
          component:()=>import("@/views/Finance/AgentList.vue")
        },
        //余额对账
        {
          path:"/HomePage/BalanceReconciliation",
          component:()=>import("@/views/DataStatistics/BalanceReconciliation.vue")
        },
        //微信打款失败列表
        {
          path:"/HomePage/WXPaymentFalse",
          component:()=>import("@/views/DataStatistics/WXPaymentFalse.vue")
        },
        //持有人提现统计
        {
          path:"/HomePage/HolderCashStatistics",
          component:()=>import("@/views/DataStatistics/HolderCashStatistics.vue")
        },
        //账户流水
        {
          path:"/HomePage/AccountWater",
          component:()=>import("@/views/DataStatistics/AccountWater.vue")
        },
        //奖励设置
        {
          path:"/HomePage/RewardSet",
          component:()=>import("@/views/SystemMange/RewardSet.vue")
        },
        //组织机构
        {
          path:"/HomePage/OrganizationInstitution",
          component:()=>import("@/views/SystemMange/OrganizationInstitution.vue")
        },
        //版本设置
        {
          path:"/HomePage/VersionSet",
          component:()=>import("@/views/SystemMange/VersionSet.vue")
        },
        //管理员
        {
          path:"/HomePage/Administrators",
          component:()=>import("@/views/PermissionMange/Administrators.vue")
        },
        //用户组
        {
          path:"/HomePage/UserGroup",
          component:()=>import("@/views/PermissionMange/UserGroup.vue")
        },
        //菜单管理
        {
          path:"/HomePage/MenuMange",
          component:()=>import("@/views/PermissionMange/MenuMange.vue")
        },
        //后台日志
        {
          path:"/HomePage/BackendLog",
          component:()=>import("@/views/OperateLog/BackendLog.vue")
        },
        //设备日志
        {
          path:"/HomePage/DeviceLog",
          component:()=>import("@/views/OperateLog/DeviceLog.vue")
        },
        //严禁投递设置
        {
          path:"/HomePage/ProhibitDeliver",
          component:()=>import("@/views/Prohibit/ProhibitDeliver.vue")
        },
      ]
    },
  ],
})

export default router
